package com.yenlien.traceyun.plant.entity;

import com.yenlien.traceyun.webase.entity.BaseEntity;
import io.swagger.annotations.ApiModelProperty;

import javax.persistence.Entity;
import javax.persistence.Table;
import javax.validation.constraints.NotBlank;

/**
 * @Date 2023/4/19
 * @Author jiaLong
 * @Descript 果园/物联网 设备的参数阈值
 */
@Entity
@Table(name = "t_dev_threshold")
public class DevThreshold extends BaseEntity {

    @NotBlank(message = "设备参数名不能为空")
    @ApiModelProperty(value = "参数名(可自定义)，不能为空")
    private String name;

    @ApiModelProperty(value = "参数类型(设备参数名)")
    private String type;

//    @NotNull(message = "最小值不能为空")
    @ApiModelProperty(value = "最小值，不能为空")
    private Double low;

//    @NotNull(message = "最大值不能为空")
    @ApiModelProperty(value = "最大值，不能为空")
    private Double high;



    @NotBlank(message = "对应的设备ID不能为空")
    @ApiModelProperty(value = "对应的设备ID(对方平台的设备编码 devId serial)不能为空，不能为空")
    private String equId;

    @NotBlank(message = "对应的企业不能为空")
    @ApiModelProperty(value = "对应的企业，不能为空")
    private String compId;

    @ApiModelProperty(value = "单位")
    private String unit;        // 单位

    @ApiModelProperty(value = "显示状态（1=显示， 2=隐藏）")
    private String state;


    public DevThreshold() {
    }

    public DevThreshold(String type, String name, String equId, String compId, String unit) {
        this.type = type;
        this.name = name;
        this.equId = equId;
        this.compId = compId;
        this.unit = unit;
        this.state = "1";
        if("土壤PH".equals(type)){
            this.high = 8.0;
            this.low = 6.0;
        }else {
            this.high = 30.0;
            this.low = -10.0;
        }
        if("照度".equals(type)){
            this.high = 70000.0;
            this.low = 0.0;
        }

    }

    public String getState() {
        return state;
    }

    public void setState(String state) {
        this.state = state;
    }


    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getUnit() {
        return unit;
    }

    public void setUnit(String unit) {
        this.unit = unit;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Double getLow() {
        return low;
    }

    public void setLow(Double low) {
        this.low = low;
    }

    public Double getHigh() {
        return high;
    }

    public void setHigh(Double high) {
        this.high = high;
    }

    public String getEquId() {
        return equId;
    }

    public void setEquId(String equId) {
        this.equId = equId;
    }

    public String getCompId() {
        return compId;
    }

    public void setCompId(String compId) {
        this.compId = compId;
    }
}
